<template>
  <div class="tab-navigation">
    <button
      v-for="tab in tabs"
      :key="tab.id"
      class="tab-item"
      :class="{ active: activeTab === tab.id }"
      @click="$emit('change', tab.id)"
    >
      <i :class="tab.icon"></i>
      <span>{{ tab.name }}</span>
    </button>
  </div>
</template>

<script setup>
defineProps({
  tabs: {
    type: Array,
    required: true,
  },
  activeTab: {
    type: String,
    required: true,
  },
})

defineEmits(['change'])
</script>

<style lang="scss" scoped>
.tab-navigation {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 48px;
  flex-wrap: nowrap;

  .tab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 24px;
    border: 1px solid var(--border-lighter);
    background: var(--bg-base);
    color: var(--text-regular);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;

    i {
      font-size: 18px;
      transition: var(--transition-base);
    }

    &:hover {
      background: var(--bg-hover);
      border-color: var(--color-primary);
      color: var(--color-primary);
      transform: translateY(-2px);
      box-shadow: var(--shadow-light);
    }

    &.active {
      background: var(--color-primary);
      border-color: var(--color-primary);
      color: #fff;
      box-shadow: 0 4px 12px rgba(81, 138, 255, 0.3);

      i {
        color: #fff;
      }

      &:hover {
        background: var(--primary-color-dark);
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(81, 138, 255, 0.4);
      }
    }
  }
}

@media (max-width: 768px) {
  .tab-navigation {
    gap: 6px;
    margin-bottom: 32px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;

    &::-webkit-scrollbar {
      display: none;
    }

    .tab-item {
      padding: 10px 16px;
      font-size: 14px;
      flex-shrink: 0;
      white-space: nowrap;

      i {
        font-size: 16px;
      }
    }
  }
}
</style>
